package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.common.utils.PageUtils;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.service.INursingProjectService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Collections;
import java.util.List;

@RestController
@RequestMapping("/member/orders/project")
public class MemberProjectController extends BaseController {

    @Autowired
    private INursingProjectService nursingProjectService;
    //查询服务项目
    @GetMapping("/page")
    public TableDataInfo<List<NursingProject>> page(NursingProject nursingProject,
                                                    @RequestParam(defaultValue = "1") Integer pageNum,  // 默认第一页
                                                    @RequestParam(defaultValue = "10") Integer pageSize ){
        //startPage();
        PageUtils.startPage(pageNum, pageSize);
        List<NursingProject> list = nursingProjectService.selectNursingProjectList(nursingProject);


        return getDataTable(list);
    }

    @GetMapping("/{id}")
    public R<NursingProject> getInfo( @PathVariable("id") Long id)
    {
        return R.ok(nursingProjectService.selectNursingProjectById(id));
    }
}
